package com.feng.cloudalibaba.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author fenggbinn
 * @title spring cloud 微服务学习
 * @create 2022/6/7 9:58
 */
@Configuration
public class ApplicationContextConfig {

    /**
     * java.net.UnknownHostException: nacos-payment-provider
     * 添加@LoadBalanced注解前报错
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
